<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="../../css/index.css" />
    <link rel="stylesheet" type="text/css" href="../../script/lib/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="css.css" />
    <style>
    	.warp{width: 100%;}
        .msg-box{width: 100%;padding: 12px 15px;box-sizing: border-box;position: relative;background: #ffffff;margin-bottom: 10px;}
        .msg-box .msg-one{width: 100%;}
        .msg-box .msg-one .img-box{width: 40px;height: 40px;}
        .msg-box .msg-one .img-box img{width: 100%;height: 100%;}
        .msg-box .msg-one .cont{flex-direction: column;}
        .msg-box .msg-one .cont .type-box{}
        .msg-box .msg-one .cont .type-box .type{font-size: 15px;color: #333333;font-weight: bold;position: relative;padding-right: 6px;box-sizing: border-box;line-height: 24px;}
        .msg-box .msg-one .cont .type-box .time{font-size: 12px;color: #8E9194;text-align: right;line-height: 24px;}
        .msg-box .msg-one .cont .title{font-size: 12px;color: #8E9194;padding-right: 40px;box-sizing: border-box;padding-top: 6px;}
        .red{height:6px;width: 6px;border-radius: 10px;background: #F13A3B;position: absolute;right: 0;top: 0;}

    </style>
</head>

<body>
    <div id="vue" class="warp">

        <div class="msg-list">

            <div :class="['msg-box', key == 0 ? 'border-top':'']" :data-id="item.id" :data-index="key" :data-opentype="item.opentype" :data-openid="item.openid" :data-type="item.type" tapmode onclick="openOtherPage(this)" v-for="(item,key) in Pdata.listData" >
            	<div class="msg-one flex">
                    <div class="cont flex flex1">
                        <div class="type-box flex">
                            <div class="type han_1" >
                                <i v-text="item.title"></i>
                                <div class="red" v-show="item.sta == 0"></div>
                            </div>
                            <div class="time flex1" v-text="item.addtime"></div>
                        </div>
                        <div class="title flex1 han_1" v-text="item.message"></div>
                    </div>
            	</div>
            </div>

            <!--占位图-->
            <div class="nodata" style="display:none;" :style="{ display:(noData ? '':'none')}">
                <img src="../../image/no_page/no_pingpai.png" />
                <p>暂无消息</p>
            </div>

        </div>

    </div>

    <script type="text/javascript" src="../../script/base.min.js" id="loadjs" data-load="L/swiper.min,L/aui-scroll"></script>
    <script type="text/javascript">
    define(function (require, exports, module) {

        var stype = pageParam.type;

        //加载数据
        _page.getData = function(loading) {
            lanYun.getVueData({url:'UserMsg/index',get:{page:lanYun.page,type:stype},cache:false,loading:loading},function(ret) {
                //console.log(JSON.stringify(ret));
            });
        };

        lanYun.newVue('#vue',{}, function() {
            _page.getData(2);
        });

        //滚动加载..
		new auiScroll({distance:200, listen:true},function(ret) {
			if($(window).scrollTop() < 2) ret.isToBottom = false;
			if(!ret.isToBottom) return;
			_page.getData(2);
		});

        //打开不用类型
        openOtherPage = function (tis) {
            var dst = tis.dataset;
            // 其他类型单个消除红点
            if(dst.type != 'sys'){
                delRed(dst.id);
            }
            // 本地消除红点
            var data = lanYun.vue.Pdata.listData;
            data[dst.index]['sta'] = 1;

            switch(dst.type){
                case "sys":
                    if(dst.opentype == 'syspage'){
                        lanYun.openWin('main0/msg_show.html', {win:'win',title:'消息详情',frameParam : dst});
                    }
                    if(dst.opentype == 'myvol'){
                        delRed(dst.id);
                        lanYun.openWin('user/quan/list.html', {win:'win',title:'我的优惠券',frameParam : {}});
                    }
                    break;
                case "audit":
                    if(dst.opentype == 'storein'){
                        lanYun.openWin('main3/ruzhu/shenhe.html', {win:'win',title:"入驻审核",border:1,frameParam : dst});
                    }
                    break;
                case "tixian":
                    var sftype = data[dst.index]['beizhu']['sftype'];
                    if(dst.opentype == 'tixianshow'){
                        lanYun.openWin('main3/bank/tx_show.html', {win:'win',title:"提现结果",frameParam : {id:dst.openid,type:sftype}});
                    }
                    break;
                case "downforced":
                    var goodstype = data[dst.index]['beizhu']['goodstype'];
                    var gtype = "";
                    if(goodstype == 1){gtype = 'jifen';}
                    if(dst.opentype == 'storeshopshow'){
                        lanYun.openWin('main3/store/goods_show.html', {win:'win',frameParam : {id:dst.openid,type:gtype}});
                    }
                    break;
                case "order":
                    if(dst.opentype == 'ordershow' || dst.opentype == 'orderclose' || dst.opentype == 'ordernopay'){
                        lanYun.openWin('ordert/ordert_show.html', {win:'win',title:"订单详情",border:'1',frameParam : {id:dst.openid}});
                    }
                    break;
                default:
                    break;
            }

        }

        //设置单个已读
        delRed = function (id) {
            lanYun.get('UserMsg/setRead?id=' + id,function (ret){
                lanYun.toast(ret.msg);
            },0)
        }

    });
    </script>
</body>
</html>
